HEVC is a new generation of video coding standard, which adopts a flexible block structure division technology for encoding coded images. In HEVC, a block structure includes a coding unit (CU), a prediction unit (PU) and a transform unit (TU). The HEVC conducts coding using the CU as a basic coding unit during a coding process. An HEVC coder firstly divides a video image into a plurality of non-overlapping largest coding units (LCUs), and then divides the LCUs into smaller CUs according to a tree structure, with sizes of CUs ranging from the LCUs to smallest coding units (SCUs). Each CU includes one or more PUs, and each CU needs to perform an inter-frame prediction or an intra-frame prediction using a PU as a unit. A problem of selecting an optimal reference frame exists in a process of inter-frame prediction.
A method for selecting an optimal reference frame in a conventional process of PU inter-frame prediction includes predicting all candidate reference frames one by one for a current PU, individually calculating a rate distortion cost corresponding to each candidate reference frame, and selecting a candidate reference frame having the minimum rate distortion cost as the optimal reference frame for the current PU. Such an ergodic selection method has a very large amount of computation. In addition, because one LCU may be divided into a plurality of CUs and one CU may have multiple inter-frame prediction division modes, each CU of an inter-frame prediction division mode includes one or more PUs. As each PU corresponding to each inter-frame prediction division mode of each CU needs to traverse all candidate reference frames in order to select a corresponding optimal reference frame, this incurs a large amount of computation and a long time on a coding process, thereby seriously affecting the coding efficiency.